<%--
  Created by IntelliJ IDEA.
  User: cyy
  Date: 2022/11/25
  Time: 14:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.cyy.bean.collect" %>
<%@ page import="java.util.ArrayList" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>
<!DOCTYPE html>
<html>
<head>
    <title>我的收藏</title>
</head>
<body>
<%
    Object message=request.getAttribute("message");
    if(message!=null&&!"".equals(message))
    {%>
    <script type="text/javascript">
        alert("<%=message%>");
    </script>
    <%}%>
    <rapid:override name="titleContent">
        <h2 align="center" style="left: 30%">我的收藏</h2>
    </rapid:override>
    <rapid:override name="btContent">
        <div align="center">
            <button onclick="returnToIndex()">回到首页</button>
        </div>
    </rapid:override>
    <rapid:override name="mainContent">
        <div class="cart-page" align="center">
            <div class="container-fluid">
                <div class="row" >
                    <div class="col-md-2">
                    </div>
                    <div class="col-md-8">
                        <div class="cart-page-inner">
                            <div class="table-responsive">
                                <table class="table table-bordered">
                                    <thead class="thead-dark">
                                    <tr>
                                        <th>商品名</th>
                                        <th>总价</th>
                                        <th>商品状态</th>
                                        <th>移除/加到购物车</th>
                                    </tr>
                                    </thead>
                                    <tbody class="align-middle" align="center">
                                    <%
                                        ArrayList<collect> collects=(ArrayList<collect>)request.getAttribute("collects");
                                        if(collects!=null)
                                        {
                                            for (int i=0;i<collects.size();i++) {%>
                                    <tr>
                                        <td><%=collects.get(i).getProductName()%></td>
                                        <td><%=collects.get(i).getPrice()%></td>
                                        <%if(collects.get(i).getUsability()==1){%>
                                        <td>在售</td>
                                        <td>
                                            <a href="/deleteCollect?productName=<%=collects.get(i).getProductName()%>"><i class="fa fa-trash"></i></a>
                                            <a href="/addToCart?productName=<%=collects.get(i).getProductName()%>&price=<%=collects.get(i).getPrice()%>"><i class="fa fa-plus-square"></i></a>
                                        </td>
                                        <%}else{%>
                                        <td>已下架</td>
                                        <td>
                                            <a href="/deleteCollect?productName=<%=collects.get(i).getProductName()%>"><i class="fa fa-trash"></i></a>
                                        </td>
                                        <%}%>
                                    </tr>
                                    <%}}%>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-2">
                    </div>
                </div>
            </div>
        </div>
    </rapid:override>
    <%@ include file="customerProductIndex.jsp"%>
</body>
</html>
